package com.remoter.basic.transport.support;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.remoter.basic.configure.IConfiguration;
import com.remoter.basic.configure.support.AbstractConfiguration;
import com.remoter.basic.provider.IProvider;
import com.remoter.basic.registry.IRegistry;
import com.remoter.basic.serialize.ISerialization;
import com.remoter.basic.transport.IServer;
import com.remoter.basic.util.Final;
import com.remoter.basic.util.ServiceLoader;

/**
 * @author			koko
 * @date 			2017-08-10 11:40:31
 * @description 	类功能说明
 */
public abstract class AbstractServer implements IServer{
	
	protected static final Logger logger = LoggerFactory.getLogger(AbstractServer.class);
	
	protected IConfiguration configuration;
	protected ISerialization serialization;
	protected IRegistry registry;
	protected IProvider provider;
	
	public AbstractServer(){
		this.configuration = AbstractConfiguration.getConfiguration();
		this.serialization = ServiceLoader.getService(ISerialization.class,this.configuration.getOption(Final.O_VAL_SERIALIZE));
		this.registry = ServiceLoader.getService(IRegistry.class,this.configuration.getOption(Final.O_VAL_REGISTRY));
		this.provider = ServiceLoader.getService(IProvider.class,this.configuration.getOption(Final.O_VAL_PROVIDER));
		logger.debug("use IConfiguration ["+configuration+"]");
		logger.debug("use ISerialization ["+serialization+"]");
		logger.debug("use IRegistry ["+registry+"]");
		logger.debug("use IProvider ["+provider+"]");
	}
	
}